﻿namespace MTO.Library.Web.Controllers.Customers.Mappers
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using MTO.Library.Domain;
    using MTO.Library.Web.Controllers.Customers.ViewModels;

    public static class CustomerIndexGridModelMapper
    {
        public static CustomerIndexGridModel Map(Customer customer)
        {
            var model = new CustomerIndexGridModel()
            {
                CustomerId = customer.CustomerId,
                FirstName = customer.FirstName,
                LastName = customer.LastName,
                StreetAdress = customer.Address.StreetAddress,
                ZipCode = customer.Address.ZipCode
            };

            return model;
        }

        public static IEnumerable<CustomerIndexGridModel> Map(IEnumerable<Customer> books)
        {
            return books.Select(x => Map(x));
        }
    }
}
